package com.集合;

import java.util.Random;
import java.util.Set;
import java.util.TreeSet;

public class 不重复随机数 {
    public static void main(String[] args) {
        Set<Integer> set=new TreeSet<Integer>();
        Random ran=new Random();
        while (set.size()<10){
            int num=ran.nextInt(10)+1;
            set.add(num);
        }
        for(Integer math:set){
            System.out.println(math);
        }
    }
}
